<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title></title>
    <meta name="keywords" content="">
    <meta name="description" content="">
    <link rel="shortcut icon" href="favicon.ico"> 
	<link href="__PUBLIC__/admin/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="__PUBLIC__/admin/css/font-awesome.css?v=4.4.0" rel="stylesheet">
    <link href="__PUBLIC__/admin/css/style.css?v=4.1.0" rel="stylesheet">
    <link rel="stylesheet" type="text/css" href="__PUBLIC__/admin/Huploadify/Huploadify.css"/>
    <script type="text/javascript" charset="utf-8" src="__PUBLIC__/ueditor/ueditor.config.js"></script>
    <script type="text/javascript" charset="utf-8" src="__PUBLIC__/ueditor/ueditor.all.min.js"> </script>
    <script type="text/javascript" charset="utf-8" src="__PUBLIC__/ueditor/lang/zh-cn/zh-cn.js"></script>
</head>

<script>
var filter = {$filter};
var pnum = {$pnum};

{if condition="(!isset($search)) OR (!$search)"}
var url = "/{$Request.module}/shop_goods/lst/filter/"+filter+".html?page="+pnum;
{else/}
var url = "/{$Request.module}/shop_goods/search.html?page="+pnum;
{/if}

var checkedUrl = "{:url('shop_goods/checked')}";
</script>

<body class="gray-bg">
<style>
input.error{
	border:1px solid red;
}
span.error{
	padding-top:10px;
	color: #f00;
	font-size:12px;
}
</style>
    <div class="wrapper wrapper-content">
        <div class="row">       
        <div class="col-sm-12">
        <div class="ibox float-e-margins">
               <div class="ibox-title">
               <h5>审核商品</h5>
               </div>
               <div class="ibox-content">
               <form method="post" enctype="multipart/form-data" class="form-horizontal" id="form">
                <div class="tabs-container">
                    <ul class="nav nav-tabs">
                        <li class="active"><a data-toggle="tab" href="#tab-1" aria-expanded="true">基本信息</a></li>
                        <li class=""><a data-toggle="tab" href="#tab-2" aria-expanded="false">商品详情</a></li>
                        <li class=""><a data-toggle="tab" href="#tab-3" aria-expanded="false">会员价格</a></li>
                        <li class=""><a data-toggle="tab" href="#tab-4" aria-expanded="false">商品属性</a></li>
                        <li class=""><a data-toggle="tab" href="#tab-5" aria-expanded="false">商品图片</a></li>
                    </ul>
                    <div class="tab-content">
                    
                        <div id="tab-1" class="tab-pane active">
                            <div class="panel-body">
                            <div class="form-group">
                                <label class="col-sm-2 control-label">商品名称:</label>
                                <div class="col-sm-6">
                                    <div style="font-size:14px; width:500px; height:100px; line-height:35px;">{$goodss.goods_name}</div>
                                </div>
                            </div>						
                            <div class="hr-line-dashed"></div>
                            
                            <div class="form-group">
                                <label class="col-sm-2 control-label">所属商家:</label>
                                <div class="col-sm-6">
                                    <div style="font-size:14px; width:500px; height:100px; line-height:35px;">{$goodss.shop_name}</div>
                                </div>        
                            </div>						
                            <div class="hr-line-dashed"></div>
                            
                           <div class="form-group">
                                <label class="col-sm-2 control-label">所属分类:</label>

                                <div class="col-sm-6">
                                    <div style="font-size:14px; width:500px; height:35px; line-height:35px;">{$goodss.cate_name}</div>
                                </div>
                            </div>
                            <div class="hr-line-dashed"></div>                             

                            <div class="form-group">
                                <label class="col-sm-2 control-label">所属品牌:</label>
                                <div class="col-sm-6">
                                    <div style="font-size:14px; width:500px; height:35px; line-height:35px;">{$goodss.brand_name}</div>
                                </div>
                            </div>
                            <div class="hr-line-dashed"></div> 
                            
                            <div class="form-group">
							<label  class="col-sm-2 control-label">缩略图:</label>
							<div class="col-sm-6" del="sfz">
                            <div style="margin-bottom:7px; margin-top:5px;">
                            <img src="{$goodss.thumb_url}" width="180" height="120" border="0" />
                            </div>
                            </div>
                            </div>
                            <div class="hr-line-dashed"></div>                              
                                                        
                            <div class="form-group">
                                <label class="col-sm-2 control-label">市场价格:</label>
                                <div class="col-sm-6">
                                    <div style="font-size:14px; width:500px; height:35px; line-height:35px;">{$goodss.market_price}</div>
                                </div>
                            </div>						
                            <div class="hr-line-dashed"></div> 
                            
                            <div class="form-group">
                                <label class="col-sm-2 control-label">会员价格:</label>
                                <div class="col-sm-6">
                                    <div style="font-size:14px; width:500px; height:35px; line-height:35px;">{$goodss.shop_price}</div>
                                </div>
                            </div>						
                            <div class="hr-line-dashed"></div>  
                            
                            <div class="form-group">
                                <label class="col-sm-2 control-label">关键字:</label>
                                <div class="col-sm-6">
                                    <div style="font-size:14px; width:500px; height:100px; line-height:35px;">{$goodss.keywords}</div>
                                </div>                   
                            </div>						
                            <div class="hr-line-dashed"></div> 
                            
                           <div class="form-group">
                           <label class="col-sm-2 control-label">简单描述:</label>
                                <div class="col-sm-6">
                                    <div style="font-size:14px; width:500px; height:100px; line-height:35px;">{$goodss.goods_brief}</div>
                                </div> 
                            </div>
                            <div class="hr-line-dashed"></div>
                            
                            <div class="form-group">
                                <label class="col-sm-2 control-label">是否上架:</label>
                                <div class="col-sm-6">
                                <div style="font-size:14px; width:500px; height:35px; line-height:35px;">{if condition="$goodss['onsale'] eq 1"}是{else condition="$goodss['onsale'] eq 0"/}否{/if}</div>
                                </div>
                            </div>
                            <div class="hr-line-dashed"></div> 
                            
                            
                            <div class="form-group">
                                <label class="col-sm-2 control-label">设为新品:</label>
                                <div class="col-sm-6">
                                <div style="font-size:14px; width:500px; height:35px; line-height:35px;">{if condition="$goodss['is_new'] eq 1"}是{else condition="$goodss['is_new'] eq 0"/}否{/if}</div>
                                </div>
                            </div>
                            <div class="hr-line-dashed"></div>  
                            
                            
                            <div class="form-group">
                                <label class="col-sm-2 control-label">设为特价:</label>
                                <div class="col-sm-6">
                                <div style="font-size:14px; width:500px; height:35px; line-height:35px;">{if condition="$goodss['is_special'] eq 1"}是{else condition="$goodss['is_special'] eq 0"/}否{/if}</div>
                                </div>                                
                            </div>
                            <div class="hr-line-dashed"></div>
                            
                            <div class="form-group">
                                <label class="col-sm-2 control-label">设为热销:</label>
                                <div class="col-sm-6">
                                <div style="font-size:14px; width:500px; height:35px; line-height:35px;">{if condition="$goodss['is_hot'] eq 1"}是{else condition="$goodss['is_hot'] eq 0"/}否{/if}</div>
                                </div>                                 
                            </div>
                            <div class="hr-line-dashed"></div>
                            
                            <div class="form-group">
                                <label class="col-sm-2 control-label">设为推荐:</label>
                                <div class="col-sm-6">
                                <div style="font-size:14px; width:500px; height:35px; line-height:35px;">{if condition="$goodss['is_recommend'] eq 1"}是{else condition="$goodss['is_recommend'] eq 0"/}否{/if}</div>
                                </div> 
                            </div>
                            <div class="hr-line-dashed"></div> 
                            
                            <div class="form-group">
                                <label class="col-sm-2 control-label">放入回收站:</label>
                                <div class="col-sm-6">
                                <div style="font-size:14px; width:500px; height:35px; line-height:35px;">{if condition="$goodss['is_recycle'] eq 1"}是{else condition="$goodss['is_recycle'] eq 0"/}否{/if}</div>
                                </div> 
                            </div>
                            <div class="hr-line-dashed"></div>                                
                                                                                                                  
                            </div>
                        </div>
                        
                        <div id="tab-2" class="tab-pane">
                            <div class="panel-body">
                            <div class="form-group">
                                <div class="col-sm-10">
                                    <textarea id="goods_desc" name="goods_desc">{$goodss.goods_desc}</textarea>
                                </div>  
                            </div>
                            </div>
                        </div>
                        
                        <div id="tab-3" class="tab-pane">
                            <div class="panel-body">                                                      
                                {foreach name="levres" item="v"}
	                            <div class="form-group">
	                                <label class="col-sm-2 control-label">{$v.level_name}:</label>
	                                <div class="col-sm-6">
	                                    <div style="font-size:14px; width:500px; height:35px; line-height:35px;">{if condition="!empty($mpres)"}{foreach name="mpres" item="v2"}{if condition="$v2['level_id'] eq $v['id']"}value="{$v2.price}"{/if}{/foreach}{/if}</div>
	                                </div>
	                            </div>						
	                            <div class="hr-line-dashed"></div>
	                            {/foreach}	                        
                            </div>
                        </div>
                        
                        <div id="tab-4" class="tab-pane">
                            <div class="panel-body">
                            <div class="form-group">
                                <label class="col-sm-2 control-label">所属类型:</label>

                                <div class="col-sm-6">
                                     <div style="font-size:14px; width:500px; height:35px; line-height:35px;">{$goodss.type_name}</div>
                                </div>
                            </div>
                            <div class="hr-line-dashed"></div>
                            
                            <div id="attr">
                            {if condition="!empty($attres)"}                          
                            {foreach name="attres" item="v"}
                            {if condition="$v['attr_type'] eq 1"}
                            
                            {if condition="!empty($gares[$v['id']])"}
                            <div class="attrgroup">                            
                            {foreach name="gares[$v['id']]" item="v2" key="k2"}                          
                            <div class="form-group">
                            <label class="col-sm-2 control-label" style="padding-top:12px;"><a href="javascript:;" onclick="attrad(this);">{if condition="$k2 eq 0"}[+]{else/}[-]{/if}</a>{$v.attr_name}</label>
                            <div class="col-sm-4">
                            <div style="padding:5px;position:relative;" class="col-sm-12">
                            <span style="position:absolute;top:5px;overflow:hidden;width:95%;height:34px;">
                            <select onchange="xzshuxing(this);" class="form-control m-b" name="xzshuxing[{$v.id}][attr_value][]">
                            <option value="">请选择</option>                            
                            <?php $attrvalues = explode(',',$v['attr_values']); foreach($attrvalues as $val):?>
                            <option value="<?php echo $val; ?>" {if condition="$v2['attr_value'] eq $val"}selected="selected"{/if}><?php echo $val; ?></option>
                            <?php endforeach; ?>                           
                            </select>
                            </span>
                            <span style="position:absolute;top:7px;left:10px;margin-top:1px;margin-left:1px;width:80%;height:28px;border-radius:5px;"><input type="text" name="goods_attr[{$v.id}][attr_value][]" value="{$v2.attr_value}" class="ccdd" placeholder="可选择也可自定义" style="width:80%;height:24px;border:0pt;border-radius:5px;outline:0">
                            </span>
                            </div>
                            </div>
                            <input type="hidden" class="gaid" name="goods_attr[{$v.id}][id][]" value="{$v2.id}">
                            <label class="col-sm-1 control-label" style="width:7%;">价格+</label>
                            <div class="col-sm-1" style="width:15%;"><input type="text" name="goods_attr[{$v.id}][attr_price][]" class="form-control" value="{$v2.attr_price}"></div>
                            </div>
                            {/foreach}                                                       
                            </div>
                            <div class="hr-line-dashed"></div>
                            
                            {else/}
                            <div class="attrgroup">
                            <div class="form-group">
                            <label class="col-sm-2 control-label" style="padding-top:12px;"><a href="javascript:;" onclick="attrad(this);">[+]</a>{$v.attr_name}</label>
                            <div class="col-sm-4">
                            <div style="padding:5px;position:relative;" class="col-sm-12">
                            <span style="position:absolute;top:5px;overflow:hidden;width:95%;height:34px;">
                            <select onchange="xzshuxing(this);" class="form-control m-b" name="xzshuxing[{$v.id}][attr_value][]">
                            <option value="">请选择</option>                            
                            <?php $attrvalues = explode(',',$v['attr_values']); foreach($attrvalues as $val):?>
                            <option value="<?php echo $val; ?>"><?php echo $val; ?></option>
                            <?php endforeach; ?>                            
                            </select>
                            </span>
                            <span style="position:absolute;top:7px;left:10px;margin-top:1px;margin-left:1px;width:80%;height:28px;border-radius:5px;"><input type="text" name="goods_attr[{$v.id}][attr_value][]" class="ccdd" placeholder="可选择也可自定义" style="width:80%;height:24px;border:0pt;border-radius:5px;outline:0">
                            </span>
                            </div>
                            </div>
                            <label class="col-sm-1 control-label" style="width:7%;">价格+</label>
                            <div class="col-sm-1" style="width:15%;"><input type="text" name="goods_attr[{$v.id}][attr_price][]" class="form-control" value="0"></div>
                            </div>
                            </div>
                            <div class="hr-line-dashed"></div>
                            {/if}
                            
                            {elseif condition="$v['attr_type'] eq 0" /}
                            
                            {if condition="$v['attr_values'] eq ''"}
                            <div class="form-group">
                            <label class="col-sm-2 control-label" style="padding-top:12px;">{$v.attr_name}</label>
                            <div class="col-sm-7">
                            <input type="text" name="goods_attr[{$v.id}][attr_value]" {if condition="!empty($gares[$v['id']])"}value="{$gares[$v['id']][0]['attr_value']}"{/if} class="form-control">
                            {if condition="!empty($gares[$v['id']])"}<input type="hidden" name="goods_attr[{$v.id}][id]" value="{$gares[$v['id']][0]['id']}">{/if}
                            </div></div><div class="hr-line-dashed"></div>
                            {else/}                            
                            <div class="form-group">
                            <label class="col-sm-2 control-label" style="padding-top:12px;">{$v.attr_name}</label>
                            <div class="col-sm-7">
                            <div style="padding:5px;position:relative;" class="col-sm-12">
                            <span style="position:absolute;top:5px;overflow:hidden;width:95%;height:34px;">
                            <select onchange="xzshuxing(this);" class="form-control m-b" name="xzshuxing[{$v.id}][attr_value]">
                            <option value="">请选择</option>
                            <?php $attrvalues = explode(',',$v['attr_values']); foreach($attrvalues as $val):?>
                            <option value="<?php echo $val; ?>" {if condition="!empty($gares[$v['id']]) && $gares[$v['id']][0]['attr_value'] eq $val"}selected="selected"{/if}><?php echo $val; ?></option>
                            <?php endforeach; ?>
                            </select>  
                            </span>
                            <span style="position:absolute;top:7px;left:10px;margin-top:1px;margin-left:1px;width:80%;height:28px;border-radius:5px;"><input type="text" name="goods_attr[{$v.id}][attr_value]" {if condition="!empty($gares[$v['id']])"}value="{$gares[$v['id']][0]['attr_value']}"{/if} class="ccdd" placeholder="可选择也可自定义" style="width:80%;height:24px;border:0pt;border-radius:5px;outline:0">
                            </span>
                            </div>                          
                            </div>
                            {if condition="!empty($gares[$v['id']])"}<input type="hidden" name="goods_attr[{$v.id}][id]" value="{$gares[$v['id']][0]['id']}">{/if}
                            </div>
                            <div class="hr-line-dashed"></div>
                            {/if}
                            {/if}
                            {/foreach}
                            {/if}                           
                            </div>
                            </div>
                        </div>
                        
                        <div id="tab-5" class="tab-pane">
                            <div class="panel-body">
                            <div class="form-group">
							<label  class="col-sm-2 control-label">商品图片:</label>
							<div class="col-sm-6">
                            <div class="imglst" style="width:685px; height:100%; overflow:hidden; margin-bottom:7px; margin-top:5px;">
                            {foreach name="goodpicres" item="v"}
                            <div class="imgli" del="pic" style="width:170px; height:180px; margin-right:10px; margin-bottom:10px; float:left;">
                            <img class="image" src="{$v.img_url}" width="150" height="100" border="0" /><br/>
                            </div>
                            {/foreach}
                            </div>
                            </div>
                            </div>
                            <div class="hr-line-dashed"></div>
                            </div>
                        </div>
                        
                    </div>
                    <input name="id" type="hidden" value="{$goodss.id}" >

                </div>
                
                
                
                     <div class="form-group" style="margin-top:50px;">
                          <label class="col-sm-2 control-label">是否设为正常：</label>
                          <div class="col-sm-6">
                              <label class="radio-inline"><input type="radio" name="checked" {if condition="$goodss['checked'] eq 1"}checked="checked"{/if} value="1">是</label>
                              <label class="radio-inline"><input type="radio" name="checked" {if condition="$goodss['checked'] eq 2"}checked="checked"{/if} value="2">否</label>
                          </div>
                     </div>
                     <div class="hr-line-dashed"></div>
                
                <div class="form-group">
                <div class="col-sm-4 col-sm-offset-2" style="margin-top:20px; margin-left:0%;">
                         <button class="btn btn-primary" type="button" id="doSubmit">确定设置</button>
                </div>
                </div>
                </form>
                
                </div>
                </div>
            </div>       
        </div>
    </div>


    <!-- 全局js -->
    <script src="__PUBLIC__/admin/js/jquery.min.js?v=2.1.4"></script>
    <script src="__PUBLIC__/admin/js/bootstrap.min.js?v=3.3.6"></script>
    <!-- 自定义js -->
    <script type="text/javascript" src="__PUBLIC__/admin/Huploadify/jquery.Huploadify.js"></script>
    <script src="__PUBLIC__/admin/js/plugins/layer/layer.min.js"></script>
    <script src="__PUBLIC__/admin/js/plugins/validate/jquery.validate.min.js"></script>	
    <!-- iCheck -->
    <script src="__PUBLIC__/admin/js/plugins/iCheck/icheck.min.js"></script>
    <script src="__PUBLIC__/admin/js/common/ajax.js"></script>
    
    <script type="text/javascript">
		//实例化编辑器
		//建议使用工厂方法getEditor创建和引用编辑器实例，如果在某个闭包下引用该编辑器，直接调用UE.getEditor('editor')就能拿到相关的实例
		UE.getEditor('goods_desc', {initialFrameWidth:'100%', initialFrameHeight:500});
	</script>

	<script>
	
    	$(function(){   		  
      	  $('#doSubmit').click(function(){
    		  var shcanshu = $('input:radio[name=checked]:checked').val();
    		  if(shcanshu == null){
    			  layer.msg('请选择设为正常或不正常', {icon: 2,time: 1000});
    			  return false;
    		  }
    			
    		  if('1,2'.indexOf(shcanshu) == -1){
    			  layer.msg('参数错误', {icon: 2,time: 1000});
    			  return false;
    		  }
    		  
    		  if(shcanshu == 1){
    			  var shuoming = '确定设为正常么？';
    		  }
    		  
    		  if(shcanshu == 2){
    			  var shuoming = '确定设为不正常么？';
    		  }
    		  
    		  var id = $('input[name=id]').val();
    		  
	  		  layer.confirm(shuoming, {  			  
				  skin: 'layui-layer-molv',
				  closeBtn: 0,
				  shadeClose : true,
				  btn: ['确定','取消'] //按钮
			  },function(){
				  layer.load(2);
				  
			      $.ajax({
				      url:"{:url('shop_goods/checked')}",
				      type:'POST',
				      data:{'id':id,'checked':shcanshu},
				      dataType:'json',
				      success:function(data){
				    	  if(data.status == 1){
				    		  layer.closeAll('loading');
				    		  layer.msg(data.mess, {icon: 1,time: 1000}, function(){
	                               location.href = url;
				    		  });
				    	  }else if(data.status == 0){
				    		  layer.closeAll('loading');
				    		  layer.msg(data.mess, {icon: 2,time: 1000});
				    	  }
				      },
				      error:function(){
				    	  layer.closeAll('loading');
				    	  layer.msg('操作失败，请重试', {icon: 2,time: 2000});
				      }
				  });
			  });
    	  });
      });
      
    </script>

</body>
</html>
